﻿package java_45;

public class penguin {
	private String name=null;
	private int health=0;
	private int love =0;
	private String sex=null;
	
	public Penguin(){
		
	}
	public Penguin(String name,int health,String sex){
	this.name=name;
	this.health=health;
	this.sex=sex;
	}
	public String getname(){
		return name;
	}
	public void setName(String name){
		this.name=name;
	}
	public int getHealth(){
		return health;
	}
	public void setHealth(int health){
		if (health<0||health>100) {
			System.out.println("健康值在0~100之间默认60");
			this.health=60;
			retuen;
		}
		this.health=helth;
	}
	public int get Love(){
		return love;
	}
	public void setSex(String sex){
		this.sex=sex;
	}
	public void print(){
		System.out.println("宠物的自白:\n我的名字是:" + this.getName() 
				 +"健康值" + this.getHealth() + "和主人的亲密度是" + 
		this.getLove() + "我是一只" + this.getSex()");
	}
}